<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <title>密码忘记</title>
    <link rel="stylesheet" type="text/css" href="__STATIC__/libs/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/addons/member/css/style.css" />
    <script src="__STATIC__/libs/layui/layui.js"></script>
    <script src="__STATIC__/libs/jquery/jquery.min.js"></script>
</head>

<body>
    <div id="mydiv">
        <div class="login-main">
            <div class="layui-elip">密码忘记</div>
            <form class="layui-form" action="{:url('forget')}">
                {:token()}
                <div class="layui-form-item">
                    <div class="layui-input-inline input-item">
                        <div class="layui-form-field-label">
                            <input type="radio" name="type" value="email" title="通过邮箱" checked lay-filter="type" data-send-url="{:url('api/ems/send')}">
                            <input type="radio" name="type" value="mobile" title="通过手机重置" lay-filter="type" data-send-url="{:url('api/sms/send')}">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item" data-type="email">
                    <div class="layui-input-inline input-item">
                        <label class="layui-icon layui-icon-email"></label>
                        <input type="text" name="email" lay-verify="email|required" autocomplete="off" placeholder="邮箱" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-hide" data-type="mobile">
                    <div class="layui-input-inline input-item">
                        <label class="layui-icon layui-icon-cellphone" for="phone"></label>
                        <input type="text" name="mobile" lay-verify="" autocomplete="off" placeholder="手机号" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline input-item" style="width: 50%">
                        <label class="layui-icon layui-icon-vercode"></label>
                        <input type="text" name="captcha" lay-verify="required" autocomplete="off" placeholder="验证码" class="layui-input">
                    </div>
                    <button class="layui-btn btn-captcha layui-btn-primary layui-border-green" type="button" data-event="resetpwd" data-type="email" data-url="{:url('api/ems/send')}">获取验证码</button>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline input-item">
                        <label class="layui-icon layui-icon-password"></label>
                        <input type="password" name="newpassword" lay-verify="required" autocomplete="off" placeholder="新密码" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-inline login-btn">
                        <button class="layui-btn" lay-submit>确定</button>
                    </div>
                </div>
                <div class="layui-trans layui-form-item layadmin-user-login-other">
                    <a href="{:url('login')}" class="layadmin-user-jump-change lay-link">用已有帐号登入</a>
                </div>
            </form>
        </div>
    </div>
    {include file="layui" /}
    <script type="text/javascript">
    layui.use(['form', 'layer','yznForm'], function() {
        var form = layui.form,
            layer = layui.layer,
            yznForm = layui.yznForm;
            
            yznForm.listen('', function (res) {
                layer.msg(res.msg, {
                    offset: '15px',
                    icon: 1,
                    time: 1000
                }, function() {
                    window.location.href = res.url;
                });
                return false;
            });
    });
    </script>
</body>

</html>